package com.project.frame.common.exception;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * desc
 *
 * @author lw007
 * @date 2021/12/22
 */
@Data
public class BaseException extends RuntimeException{
    private static final long serialVersionUID = -5433056591268198786L;
    protected Integer code;
    private Map<String, String> msgs = new HashMap<String, String>();

    public BaseException() {
        super();
    }


    /**
     * 构造函数
     * @param message 错误信息
     */
    public BaseException(String message) {
        super(message);
    }

    /**
     * 构造函数
     * @param code 错误代码
     * @param message 错误信息
     */
    public BaseException(Integer code,String message) {
        super(message);
        this.code = code;
    }
    /**
     * 构造函数
     * @param code 错误码
     */
    public BaseException(CommonResponseCode code) {
        super(code.getName());
        this.code = code.getCode();
    }

    public BaseException(Throwable cause) {
        super(cause);
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }


}
